package com.unknown.explorer;

import com.threed.jpct.Logger;
import com.threed.jpct.Object3D;
import com.threed.jpct.Primitives;

public class puzzleFactory {

	/**
	 * Creation of primitives
	 * 
	 * @param type	type of geometry
	 * @param size	array of geometry sizes (cube: 1-length, box: 1-length 2-height scale, cone: 1-faces 2-cone size 3-cone height scale, ellipsoid 1-faces 2-width scale 3-height scale, pyramid 1- width scale 2-height scale)
	 * @return Object3D
	 */
	public Object3D create(String type, float... sizes)
	{
		Object3D newObj;
		
		if(type == "cube" && sizes.length >= 1)
		{
			newObj = Primitives.getCube(sizes[0]);
		}

		else if(type == "box" && sizes.length >= 2)
		{
			newObj = Primitives.getBox(sizes[0], sizes[1]);
		}
		
		else if(type == "cone" && sizes.length >= 3)
		{
			newObj = Primitives.getCone((int)sizes[0], sizes[1], sizes[2]);	
		}
		
		else if(type == "ellipsoid" && sizes.length >= 3)
		{
			newObj = Primitives.getEllipsoid((int)sizes[0], sizes[1], sizes[2]);
		}
		
		else if(type == "cylinder" && sizes.length >= 3)
		{
			newObj = Primitives.getCylinder((int)sizes[0], sizes[1], sizes[2]);
		}
		
		else if(type == "pyramid" && sizes.length >= 2)
		{
			newObj = Primitives.getPyramide(sizes[0], sizes[1]);
		}
		
		else
		{
			newObj = null;
		}
		
		return newObj;
	}
	
}
